import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import elementUI from "element-ui";
import i18n from "./lang";
import "element-ui/lib/theme-chalk/index.css";
import "./styles/element-variables.scss";
import "normalize.css/normalize.css";
import * as ECharts from "echarts"; //全局引入
import * as directives from "./directives";
import * as filters from "./filters";
import * as components from "./components";
import evmessage from "./components/EvMessage/index.js";

Vue.prototype.$evmessage = evmessage;
// 全局注册指令
Object.keys(directives).forEach((key) => {
  Vue.directive(key, directives[key]);
});

//全局注册过滤器
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});

//全局注册组件
Vue.use(components);
Vue.use(elementUI, { i18n: (key, value) => i18n.t(key, value) });
Vue.config.productionTip = false;
Vue.prototype.$echarts = ECharts;

new Vue({
  router,
  store,
  i18n,
  beforeCreate() {
    Vue.prototype.$bus = this;
  },
  render: (h) => h(App),
}).$mount("#app");
